package com.dyz.model;

public final class Koszty extends AFaktura {
	
	private static float cenaNeto[] = new float[12];

	private float cenaNetto, cenaNettodod, cenaBrutto, kwotaVat;

	public Koszty(String number, String data, String companyName,
			String adress, String descr, int vat, float cenaNetto,
			float cenaNettodod) {
		super(number, data, companyName, adress, descr, vat);
		this.cenaNetto = cenaNetto;
		this.cenaNettodod = cenaNettodod;
		cenaBrutto = oblKwoteVat();
		kwotaVat = oblVat();
		cenaNeto[super.m-1]+=cenaNetto;
	}
	
	public static float getCenaNeto(int miesiac){
		return cenaNeto[miesiac];
	}

	private float oblSume() {
		return cenaNetto + cenaNettodod;
	}

	private float oblVat() {
		return oblSume() * vat / 100;
	}

	private float oblKwoteVat() {
		return oblSume() * vat / 100 + oblSume();
	}

	public String toString() {
		return super.toString().concat(
				String.format("%.2f  %d  %.2f  %.2f  %.2f  koszt", cenaNetto,
						vat, kwotaVat, cenaBrutto, cenaNettodod));
	}

	public String toFormatString() {
		return super.toFormatString().concat(
				String.format("|%-10.2f|%-3d|%-10.2f|%-10.2f|%-10.2f| koszt",
						cenaNetto, vat, kwotaVat, cenaBrutto, cenaNettodod));
	}

	public boolean isPrzychod() {
		return false;
	}

	public float getCenaNetto() {
		return cenaNetto;
	}

}
